import { BaseMode } from "./interface";
import { Utils } from "./util";

let util = new Utils();
export class IteratorTest implements BaseMode{
    run(){
        //Symbols是不可改变且唯一的。
        let sym2 = Symbol("key");
        let sym3 = Symbol("key");
        util.log(sym2 === sym3,"symbols是唯一的");

        let pets = new Set(["Cat", "Dog", "Hamster"]);
        pets.add("mammals");
        // pets["species"] = "mammals";

        for (let pet in pets) {
            util.log(pet,"for ... in"); // "species"
        }

        for (let pet of pets) {
            util.log(pet,"for ... of"); // "Cat", "Dog", "Hamster"
        }
    }
}